<?php
$user = [
    'username' => '张三',
    'score' => 90
];

// json_encode() 加数组转化成json字符串
// json_decode() 将json字符串转换成数组

$str = json_encode($user);

print_r(json_decode($str, true));
